Skip to content

feat: update VerificationResult when interactions get added#495

Merged
vbreuss merged 2 commits intomainfrom
topic/update-verification-result-with-background-interactions
Feb 28, 2026
Merged

feat: update VerificationResult when interactions get added#495
vbreuss merged 2 commits intomainfrom
topic/update-verification-result-with-background-interactions

Conversation

@vbreuss
Copy link
Copy Markdown
Contributor

@vbreuss vbreuss commented Feb 28, 2026

This PR updates verification results so they reflect newly registered mock interactions, aligning VerificationResult behavior with dynamic interaction recording in Mockolate.

Key Changes:

  • Refactors VerificationResult<T> to store a predicate and recompute matching interactions on each Verify call.
  • Updates verification registration to pass predicates instead of precomputed interaction arrays.
  • Adds/updates tests covering verification updates over time and interaction registration notifications.

@vbreuss vbreuss self-assigned this Feb 28, 2026
Copilot AI review requested due to automatic review settings February 28, 2026 14:04
@vbreuss vbreuss added the enhancement New feature or request label Feb 28, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 28, 2026

Test Results

    21 files  ± 0      21 suites  ±0   5m 40s ⏱️ +8s
 2 758 tests + 3   2 757 ✅ + 3  1 💤 ±0  0 ❌ ±0 
18 523 runs  +21  18 522 ✅ +21  1 💤 ±0  0 ❌ ±0 

Results for commit e3e5524. ± Comparison against base commit 64405fe.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates verification results so they reflect newly registered mock interactions, aligning VerificationResult behavior with dynamic interaction recording in Mockolate.

Changes:

  • Refactors VerificationResult<T> to store a predicate and recompute matching interactions on each Verify call.
  • Updates verification registration to pass predicates instead of precomputed interaction arrays.
  • Adds/updates tests covering verification updates over time and interaction registration notifications.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Tests/Mockolate.Tests/Verify/VerificationResultExtensionsTests.cs Updates VerificationResult construction to match the new constructor signature.
Tests/Mockolate.Tests/Verify/MockVerifyTests.cs Adds a test ensuring IVerificationResult reflects interactions added after the result is created.
Tests/Mockolate.Tests/ItTests.MatchesTests.cs Ensures regex timeout is exercised by executing the verification (AtLeastOnce).
Tests/Mockolate.Tests/Interactions/MockInteractionsTests.cs Adds tests for interaction registration and the new notification event.
Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt Updates expected public API surface (constructor signature + new event).
Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt Updates expected public API surface (constructor signature + new event).
Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt Updates expected public API surface (constructor signature + new event).
Source/Mockolate/Verify/VerificationResult.cs Implements predicate-based matching and recomputation on Verify.
Source/Mockolate/MockRegistration.Verify.cs Switches verification result creation to pass predicates instead of snapshots.
Source/Mockolate/Interactions/MockInteractions.cs Adds an InteractionAdded notification and raises it when registering interactions.

Comment thread Tests/Mockolate.Tests/Verify/MockVerifyTests.cs Outdated
Comment thread Source/Mockolate/Interactions/MockInteractions.cs Outdated
Comment thread Source/Mockolate/Verify/VerificationResult.cs
Comment thread Source/Mockolate/Verify/VerificationResult.cs
Comment thread Tests/Mockolate.Tests/Verify/MockVerifyTests.cs Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 28, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.103
[Host] : .NET 10.0.3 (10.0.3, 10.0.326.7603), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockolate 1.477 μs 0.0098 μs 0.0087 μs 0.2460 - 4.02 KB
Simple_Moq 175.909 μs 1.2477 μs 1.1061 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.638 μs 0.0319 μs 0.0298 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.227 μs 0.0710 μs 0.0664 μs 0.4959 - 8.11 KB

@vbreuss vbreuss enabled auto-merge (squash) February 28, 2026 16:14
@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss merged commit ddabf6d into main Feb 28, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/update-verification-result-with-background-interactions branch February 28, 2026 16:16
@github-actions
Copy link
Copy Markdown

This is addressed in release v1.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants